'''
Created on 2013-3-25

@author: zhiyong.luo
'''
from framework.bottle import Bottle,redirect,request
from jinja2.environment import Environment
from jinja2.loaders import FileSystemLoader
from google.appengine.api import users

#jinja2
env = Environment(loader = FileSystemLoader('templates'))
indexc = Bottle()
        
@indexc.route('/')    
def welcome():
    name = login()
    template = env.get_template('index.html')
    return template.render(the= name, go='here33')

def login():
    user = users.get_current_user()
    if user:
        return user.nickname()
    else:
        redirect(users.create_login_url(request.url))

    
        
    